package entry42.pre;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import org.junit.Test;

public class Max {
	public int max(int... args) {
		if (args.length == 0) {
			throw new IllegalArgumentException("인자 없음");
		}

		int max = args[0];
		for (int i = 0; i < args.length; i++) {
			if (args[i] > max) {
				max = args[i];
			}
		}

		return max;
	}

	public int intLength(int... array) {
		return array.length;
	}

	public int length(Object... array) {
		return array.length;
	}

	@Test
	public void testMax() {
		assertThat(max(2, 3, 1), is(3));
	}
}
